﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;

namespace WmsService.Exceptions
{
    public class AppServerException : Exception
    {
        private const string  ErrorPrix = "对不起，服务器发生了错误，必要情况请截图保存以备排错。\n具体错误信息如下：\n";
        public AppServerException():base()
        {
            
        }
        public AppServerException(string message): base( message)
        {
            
        }
        public AppServerException(string message, Exception innerException): base(message, innerException)
        {
            
        }
        protected AppServerException(SerializationInfo info, StreamingContext context): base(info, context)
        {
            
        }

        public override string Message
        {
            get
            {
                if (! String.IsNullOrEmpty(base.Message) && base.Message.StartsWith(ErrorPrix))
                {
                    return base.Message;
                }
                return ErrorPrix + base.Message;
            }
        }

        public override string ToString()
        {
            return ErrorPrix + base.ToString();
        }

    }
}